home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
hardware
/
host.arc
/
HOST.BAT
< prev
next >
Wrap
DOS Batch File
|
1989-01-31
|
4KB
|
85 lines
echo off
REM HOST.bat by Hale Pringle, University of Central Florida, LAN Institute.
REM Note: this could just as easily be used with PC Anywhere, or REMOTE
REM Objective: Have my office phone answered by a modem with CC at night
REM and during weekends and answered normally during office hours.
REM HOST.bat will wait until 18:00 and then boot Carbon Copy and wait for
REM a call. At 7:00 the next morning the PC reboots and the modem is disabled
REM until 18:00 that night. On weekend the PC reinstalls CC.
REM During the day (7:00 to 18:00) the phone is answered normally.
REM At night (18:00 until 7:00) and during weekends the phone is answered by
REM a modem attached to my PC which has Carbon Copy running.
REM
REM If you type HOST when you leave the office
REM If the time is before 18:00 the PC waits and then install CC
REM If the time is after 18:00 it boots CC immediately.
REM
REM This system needs DAYCHECK.exe, WAITUTIL.com & REBOOT.com to execute.
REM HOST.bat needs to be in the root of C:. The rest should be in a sub-
REM directory called CARBON.
REM
REM First get to the C: drive and to the Carbon subdirectory
c:
cd \
cd \carbon
REM Next create a FLAG for autoexec.bat file to see.
REM I put the line IF EXIST C:\CARBON\DOcc.BAT host
REM at the end of my autoexec.bat file. If the file exists, I ran HOST
REM Everywhere that this batch file goes into a wait state I erase DOCC.BAT
REM If I CTRL BREAK out of the batch and do not rerun HOST, the autoexec will
REM not call HOST.BAT. If the wait state finishes without me and the PC
REM automatically reboots, this batch will be run again.
copy c:\host.bat DOcc.bat > nul:
rem ECHO CASTOFF will give 'Bad Command or File name' if you are off your network
ECHO CASTOFF
CASTOFF > nul:
ECHO BREAK
BREAK=ON > nul:
echo .
echo off
REM First what day is it? Sat & Sun load carbon copy, else wait for 18:00
DAYCHECK DAY
rem Sunday
if errorlevel 0 if not errorlevel 1 echo SUNDAY
if errorlevel 0 if not errorlevel 1 goto :DOCC
rem Monday...
if errorlevel 1 if not errorlevel 6 echo MONDAY THRU FRIDAY
if errorlevel 1 if not errorlevel 6 goto :CHK
rem Saturday
if errorlevel 6 if not errorlevel 7 echo SATURDAY
if errorlevel 6 if not errorlevel 7 goto :DOCC
echo .
ECHO Should not get here...(bad DOW)
:CHK
REM Next check the hour. If after 18:00 load CC, else wait for 18:00
DAYCHECK HOUR
if errorlevel 0 if not errorlevel 7 echo BEFORE 7 am
if errorlevel 0 if not errorlevel 7 goto :DOCC
if errorlevel 7 if not errorlevel 18 echo AFTER 7 AM AND BEFORE 6 PM
if errorlevel 7 if not errorlevel 18 goto :wait18
if errorlevel 18 if not errorlevel 23 echo AFTER 6 PM
if errorlevel 18 if not errorlevel 23 goto :DOCC
ECHO Should not get here...(bad hour)
:wait18
REM If I CTRL BREAK here or reboot here, I do not want Carbon Copy to load
erase docc.bat >nul:
echo .
ECHO Press CTRL BREAK and say Y (exit batch file) to work without Carbon Copy
ECHO WAIT for 18:00
WAITUNTL 18:00:00
:DOCC
CC
REM If I CTRL BREAK here or reboot here, I DO want Carbon Copy to load
echo .
ECHO Press CTRL BREAK and say Y (exit batch file) to work with Carbon Copy
ECHO remotely. Erase C:\CARBON\DOCC.bat to boot after 18:00 without CC.
ECHO WAIT for 7:00
copy c:\host.bat docc.bat >nul:
WAITUNTL 07:00:00
REM If this has executed, I want HOST.BAT rerun, wait for 18:00, redo CC, etc.
copy c:\host.bat docc.bat >nul:
reboot
REM Remember, the line in AUTOEXEC.BAT will call host.bat if this executes.